package cn.tedu.oa_system.controller;

import cn.tedu.oa_system.base.json_result.ResultDataDto;
import cn.tedu.oa_system.base.json_result.ResultDto;
import cn.tedu.oa_system.pojo.Position;
import cn.tedu.oa_system.pojo.in.PositionIn;
import cn.tedu.oa_system.service.PositionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author MW
 * @Description 职位控制器
 * @CreateDate 2023/1/5
 */
@RestController
@RequestMapping("/position")
@Slf4j
public class PositionController {

    @Autowired
    private PositionService service;

    @GetMapping("/list")
    private ResultDataDto<Position> list(){
        return service.list();
    }

    @PostMapping("/addnewposition")
    private ResultDto<Void> addNewPosition(@RequestBody PositionIn positionIn){
        return service.addNewPosition(positionIn);
    }

    @PostMapping("/updateposition")
    private ResultDto<Void> updatePosition(@RequestBody PositionIn positionIn){
        return service.updatePosition(positionIn);
    }
}
